﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Company_company_con_left : System.Web.UI.UserControl
{
    public string UserID;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            left();
            dd();
        }
    }
    public void left()
    {

        if (Request.QueryString["p_UserID"] != null)
        {
            int uid = int.Parse(Request.QueryString["p_UserID"]);
            DataTable dt = Class1.ExecSel("select * from wj_User where  wj_ID=" + uid + "");
            lb_name.Text = dt.Rows[0]["wj_Connecter"].ToString();
            lb_tel.Text = dt.Rows[0]["wj_Phone"].ToString();
            lb_mb.Text = dt.Rows[0]["wj_Mobile"].ToString();
            lb_fax.Text = dt.Rows[0]["wj_Fax"].ToString();
            lb_Dept.Text = dt.Rows[0]["wj_Dept"].ToString();
            UserID = Convert.ToString(dt.Rows[0]["wj_ID"].ToString());
        }
    }
    private void dd()
    {
        if (Request.QueryString["p_UserID"] != null)
        {
            int uid = int.Parse(Request.QueryString["p_UserID"]);
            DataTable dt = Class1.ExecSel("select * from product where p_UserID=" + uid + "");


            if (dt != null && dt.Rows.Count > 0)
            {
                string aa = dt.Rows[0]["p_z_ID"].ToString();
                SqlConnection con = Class1.DBconnection();
                con.Open();
                SqlCommand cmd = new SqlCommand("select * from Class where  Menu_ID='" + aa + "'", con);
                SqlDataReader sdr = cmd.ExecuteReader();
                DataList1.DataSource = sdr;
                DataList1.DataKeyField = "Menu_ID";
                DataList1.DataBind();

                con.Close();
                con.Dispose();
                cmd.Dispose();
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string skw = TextBox1.Text;
        Response.Redirect("product_search.aspx?wj_Words=" + skw + "&p_UserID=" + Request.QueryString["p_UserID"] + "");
    }
}
